
    // 显示修改密码弹窗
    function showChangePasswordModal() {
        $.post(FromUrl,{type:'change_pwd',gid:gid},function(html) {
            document.getElementById('floatBall').insertAdjacentHTML('afterend', html);
        });
        hideAccountCenter();
    }

    // 隐藏修改密码弹窗
    function hideChangePasswordModal() {
        document.getElementById('changePasswordModal').remove();
        showAccountCenter();
    }

    // 修改密码
    function changePassword() {
        const oldPassword = document.getElementById('oldPassword').value;
        const newPassword = document.getElementById('newPassword').value;
        const confirmNewPassword = document.getElementById('confirmNewPassword').value;

        // 表单验证
        if (!oldPassword || !newPassword || !confirmNewPassword) {
            layer.msg('请填写完整信息');
            return;
        }

        if (newPassword !== confirmNewPassword) {
            layer.msg('两次输入的新密码不一致');
            return;
        }

        // 这里添加修改密码API调用
        const data = {
            old_password: oldPassword,
            password: newPassword,
            token: token,
            gid: gid,
            cid: cid
        };

        $.post(changePasswordUrl, data, function(info) {
            if (info.code != 1) {
                layer.msg(info.msg, {time: 2000});
                return;
            }
            layer.msg('密码修改成功', {time: 2000});
            hideChangePasswordModal();
        });
    }